package com.youmingxing.bean;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * @author evilyin(ChenZhixi)
 * @since 15/11/21
 */
public class Section {
    public int template;
    public String title;
    public boolean more;
    public String more_tip;
    public Action more_action;
    public List<SectionContent> sectionContentList = new ArrayList<>();

    public Section(JSONObject object) {
        template = object.optInt("template");
        title = object.optString("title");
        more = object.optBoolean("more");
        more_tip = object.optString("more_tip");
        more_action = new Action(object.optJSONObject("more_action"));
        JSONArray array = object.optJSONArray("contents");
        for (int i = 0; i < array.length(); i++) {
            SectionContent sectionContent = new SectionContent(array.optJSONObject(i));
            sectionContentList.add(sectionContent);
        }
    }

}
